-
-
Notifications
You must be signed in to change notification settings - Fork 145
Add some missing Optional type annotations to interval_range
and read_sql
#1315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
start: int = ..., | ||
end: int = ..., | ||
start: int | None = ..., | ||
end: int | None = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
columns: list[str] = ..., | ||
columns: list[str] | None = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
595ca71
to
93fac58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to fix the other defaults for read_sql()
that would be good as well, but not a problem if you don't.
@@ -115,7 +115,7 @@ def read_sql( | |||
| None | |||
) = ..., | |||
parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., | |||
columns: list[str] = ..., | |||
columns: list[str] | None = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like #1293 missed the defaults for read_sql()
. So can you make this columns: list[str] | None = None
(and below as well)?
interval_range
and read_sql
@overload | ||
def interval_range( # pyright: ignore[reportOverlappingOverload] | ||
start: int, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[int]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having corrected the first overload, this one would never be matched, so it can be removed
@overload | ||
def interval_range( | ||
start: float, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[float]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
def interval_range( | ||
start: _TimestampLike, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timestamp]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@overload | ||
def interval_range( | ||
start: _TimedeltaLike, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timedelta]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
These are some cases where the overloads indicate that they are meant to match the parameter defaults, which in all these cases are
= None
. However,None
is currently missing from the annotations for these parametersassert_type()
to assert the type of any return value